angular.module('app').controller('registerCtrl',['$interval','$scope','$http','$state',function($interval,$scope,$http,$state){
	$scope.submit = function (){
		$http.post('data/regist.json',$scope.user).success(function(res){
			console.log(111);
			$state.go('login')
		})
	}
	$scope.send = function (){
		$http.get('data/code.json').success(function(res){
			if(1===res.state){
				$scope.time = 10
				var timer = $interval(function(){
					if($scope.time<=0){
						$interval.cancel(timer);
						$scope.time = '';
						return;
					}
					$scope.time --;
				},1000)
			}
		})
	}
	
}])